function main(){
    let unitLitigant = window.unitLitigant;
    let pageRenderElement = this.$$root().$parent.$parent.$parent;
    let self = this;
    if (!unitLitigant || unitLitigant.length === 0) {
        console.log("没有数据可供处理");
        // 可以弹出提示框或者执行其他操作
        self.$message.warning("请最少添加一条认领主体！")
        return;
    }

    for (let i = 0; i < unitLitigant.length; i++) {
        let matterData = unitLitigant[i];
        insertLawUnitMatterGroupRel(matterData).then(r => {
            console.log(r);
        });
    }

    window.unitLitigant = [];
    window.moduleActionType = 'form-save';
    pageRenderElement.goHistory(-1);

}



/**
 * law_unit_matter_group_rel
 * @param matterData
 */
function insertLawUnitMatterGroupRel(matterData) {

    const insertTaskObjects = [
        ['group_id', matterData.group_id],
        ['matter_id', matterData.matter_id],
        ['matter_code', `'${matterData.matter_code}'`],
        ['create_time', 'NOW()']
    ];

    const formattedFields = insertTaskObjects.map(([key, value]) => {
        return `'${key}',${value}`;
    });

    const law_unit_matter_group_rel = "ds_tbl:t_3f8e0c27a0bc448a8a527cb5ba6ec7fa";
    const insertSql = `INSERT('${law_unit_matter_group_rel}', [${formattedFields.join(',')}])`;
    console.log(insertSql);


    return new Promise((resolve, reject) => {
        api.EXEC_FORMULA(insertSql).then(res => {
            console.log(res);
            resolve(res);
        })
    })

}
